<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/aui/aui-win.css" />
		<link rel="stylesheet" type="text/css" href="../css/iconfont/iconfont.css" />
		<style type="text/css">
			.display-none {
				display: none;
			}
			#aui-footer .aui-iconfont {
				font-size: 25px;
			}
			#aui-footer {
				background: #f7f7f7;
				border-top: 1px solid #e2e2e2;
			}
			.aui-bar-1d9dd5 {
				background: #4385f6;
			}
			.aui-bar-fff {
				background: #fff;
			}
			#aui-footer li.active-1d9dd5, #aui-footer li.active-1d9dd5 span.iconfont {
				color: #4385f6 !important;
			}
			#bbs-channel {
				line-height: normal;
				height: 50px;
				background: #fff;
				display: -webkit-box;
				display: -webkit-flex;
				display: flex;
				-webkit-box-orient: horizontal;
				-webkit-flex-flow: row;
				flex-flow: row;
				width: 100%;
				border-bottom: 1px solid #d9d9d9;
			}
			#bbs-channel p {
				-webkit-box-flex: 1;
				-webkit-flex: 1;
				flex: 1;
				color: #999999;
				font-size: 13px;
				display: -webkit-box;
				-webkit-box-orient: horizontal;
				-webkit-box-pack: center;
				-webkit-box-align: center;
				display: box;
				box-orient: horizontal;
				box-pack: center;
				box-align: center;
			}
			#bbs-channel p span {
				display: inline-block;
				padding: 5px 5px;
				background: #fff;
				border-radius: 3px;
				-webkit-border-radius: 3px;
			}
			#bbs-channel p.active span {
				background: #4385f6;
				color: #fff;
			}
			#bbs-channel div {
				width: 40px;
				font-size: 14px;
				display: -webkit-box;
				-webkit-box-orient: horizontal;
				-webkit-box-pack: center;
				-webkit-box-align: center;
				display: box;
				box-orient: horizontal;
				box-pack: center;
				box-align: center;
			}
			#bbs-channel div i {
				color: #4385f6;
				font-size: 20px;
			}
			#case-header {
				color: #555;
			}
			#case-header span {
				color: #888;
			}
			#case-header .aui-line-x {
				margin-top: 46px;
				width: 100%;
				position: relative;
				height: 1px;
			}
			#case-header  .aui-line-x:after {
				border-bottom: 1px solid #f3f1f1;
				display: block;
				content: '';
				position: absolute;
				top: 0;
				right: 0;
				bottom: 0;
				left: 0;
				-webkit-transform-origin: 0 0;
				-webkit-transform: scale(1);
				pointer-events: none;
			}
		</style>
	</head>
	<body>
		<header class="aui-bar aui-bar-nav aui-bar-fff header" id='case-header'>
			<a class="aui-pull-left" tapmode onclick="H.openSlidPane();"> <span class="aui-iconfont iconfont icon-more-menu"></span> </a>
			<div class="aui-title">
				葵花宝典
			</div>
			<a class="aui-pull-right" tapmode id="version"> <span class="aui-iconfont iconfont icon-guanyu"></span> </a>
			<div class="aui-line-x"></div>
		</header>
		<header class="aui-bar aui-bar-nav aui-bar-1d9dd5 header display-none" id='bbs-header'>
			<a class="aui-pull-left" tapmode onclick="H.openSlidPane();"> <span class="aui-iconfont iconfont icon-more-menu"></span> </a>
			<div class="aui-title">
				指点迷津
			</div>
			<a class="aui-pull-right" tapmode id="search-bbs"> <span class="aui-iconfont iconfont icon-sousuo"></span> </a>
			<nav id="bbs-channel">
				<p class="active">
					<span>推荐文章</span>
				</p>
				<p>
					<span>最新回复</span>
				</p>
				<p>
					<span>最新发帖</span>
				</p>
				<p>
					<span>我有想法</span>
				</p>
				<div id="showmore">
					<i class="iconfont icon-gengduo"></i>
				</div>
			</nav>
		</header>
		<header class="aui-bar aui-bar-nav aui-bar-1d9dd5 header display-none" id='shareFind-header'>
			<a class="aui-pull-left" tapmode onclick="H.openSlidPane();"> <span class="aui-iconfont iconfont icon-more-menu"></span> </a>
			<div class="aui-title">
				流连忘返
			</div>
			<a class="aui-pull-right" tapmode id="push-findShare" data-isopen="false"> <span class="aui-iconfont iconfont icon-tianjia"></span> </a>
		</header>
		<header class="aui-bar aui-bar-nav aui-bar-1d9dd5 header display-none" id='ucenter-header'>
			<a class="aui-pull-left" tapmode onclick="H.openSlidPane();"> <span class="aui-iconfont iconfont icon-more-menu"></span> </a>
			<div class="aui-title"></div>
			<a class="aui-pull-right" tapmode onclick="H.$openWin('ucenter_setting_head','./ucenter/ucenter_setting_head.html');"> <span class="aui-iconfont iconfont icon-shezhi"></span> </a>
		</header>
		<footer class="aui-nav" id="aui-footer">
			<ul class="aui-bar-tab">
				<li class="active-1d9dd5" data-header="case" tapmode>
					<span class="aui-iconfont iconfont icon-anli"></span>
					<p>
						葵花宝典
					</p>
				</li>
				<li data-header="bbs" tapmode >
					<span class="aui-iconfont iconfont icon-b"></span>
					<p>
						指点迷津
					</p>
				</li>
				<li data-header="shareFind" tapmode >
					<span class="aui-iconfont iconfont icon-faxian"></span>
					<p>
						流连忘返
					</p>
				</li>
				<li data-header="ucenter" tapmode >
					<span class="aui-iconfont iconfont icon-user_set"></span>
					<p>
						分寸之席
					</p>
				</li>
			</ul>
		</footer>
	</body>
	<script type="text/javascript" src="../script/AHelper.js"></script>
	<script type="text/javascript" src="../script/zepto.min.js"></script>
	<script type="text/javascript">
		// name数字表示分类id
		var bbs_Frams = [{
			url : "./bbs/bbs_main_body.html",
			name : "bbs_main_body" + 1,
			pageParam : {
				cid : 1
			}
		}, {
			url : "./bbs/bbs_main_body.html",
			name : "bbs_main_body" + 2,
			pageParam : {
				cid : 2
			}
		}, {
			url : "./bbs/bbs_main_body.html",
			name : "bbs_main_body" + 3,
			pageParam : {
				cid : 3
			}
		}, {
			url : "./bbs/bbs_main_body.html",
			name : "bbs_main_body" + 4,
			pageParam : {
				cid : 4
			}
		}];
		// 首页frame组
		var indexFrames = [];
		// 设置指点迷津对应分类选中
		function setBBSChannelChecked(index) {
			$("#bbs-channel p").eq(index).addClass("active").siblings("p").removeClass("active");
		}

		// 隐藏所有的frame
		function hideAllFrame(frameName) {
			$("#aui-footer li").each(function() {
				var headerId = $(this).attr("data-header");
				if (frameName != headerId) {
					if (headerId != "bbs") {
						// 设置所有的frame先隐藏起来
						H.$setFrameStatus(headerId, true);
					} else {
						H.$setFrameGroupStatus(headerId, true);
					}
				} else {
					if (headerId != "bbs") {
						// 直接显示出来
						H.$setFrameStatus(headerId, false);
					} else {
						H.$setFrameGroupStatus(headerId, false);
					}
				}
			});
		}

		// 显示对应frame
		function showActiveFrame(index) {
			var that = $("#aui-footer li").eq(index);
			// 获取data-header存储的值
			var headerId = that.attr("data-header");
			// 对应的dom头部
			var headerDOM = headerId + "-header";
			that.addClass("active-1d9dd5").siblings().removeClass("active-1d9dd5");
			$("#" + headerDOM).removeClass("display-none").siblings(".header").addClass("display-none");
			if (indexFrames.indexOf(headerId) == -1) {
				// 是否是指点迷津，指点迷津是frameGroup
				if (headerId != "bbs") {
					// 打开新的frame
					H.$openFrameWithNav(headerDOM, {
						url : "./" + headerId + "/" + headerId + "_body.html",
						name : headerId
					}, 'aui-footer');
				} else {
					H.$openFrameGroupWithNav(function(ret, err) {
						setBBSChannelChecked(ret.index);
					}, headerDOM, {
						name : headerId,
						frames : bbs_Frams
					}, 'aui-footer');
				}
				// 添加到数组中，标识这个frame已经打开，下次直接显示出来，无需在打开
				indexFrames.push(headerId);
			}
			// 隐藏所有
			hideAllFrame(headerId);
		}

		Zepto(function($) {
			$("#aui-footer li").on("tap", function() {
				// 调用
				showActiveFrame($(this).index());
			});
			// 发布所见所闻
			$("#push-findShare").on("tap", function() {
				var isopen = $(this).attr("data-isopen");
				if (isopen == "false") {
					$(this).children("span").attr("class", "aui-iconfont iconfont icon-guanbi");
					$(this).attr("data-isopen", "true")
					// 快速打开窗口
					H.$fixStatusBar(function(offset) {
						H.$openFrame('push_findShare', './shareFind/push_findShare.html', null, {
							x : 0,
							y : offset.h
						});
					}, 'shareFind-header');
				} else {
					$(this).children("span").attr("class", "aui-iconfont iconfont icon-tianjia");
					$(this).attr("data-isopen", "false")
					H.$execScript(null, 'push_findShare', 'closeShareFrame();');
				}
			});
			// 点击切换
			$("#bbs-channel").on("tap", "p", function() {
				var index = $(this).index();
				$(this).addClass("active").siblings("p").removeClass("active");
				// 设置索引
				H.$setFrameGroupIndex('bbs', index);
			});
			// 指点迷津更多
			$("#showmore").on("tap", function() {
				H.$fixStatusBar(function(offset) {
					H.$openFrame('more_channel', './bbs/more_channel.html', null, {
						x : 0,
						y : offset.h
					});
				}, 'bbs-header');
			});
			// 搜索
			$("#search-bbs").on("tap", function() {
				// 快速打开窗口
				H.$fixStatusBar(function(offset) {
					H.$openFrame('search_bbs_body', './bbs/search_bbs_body.html', null, {
						x : 0,
						y : offset.h
					});
				}, 'bbs-header');
			});
			// 查看版本
			$("#version").on("tap", function() {
				H.$openFrame('version', 'version.html', null, {
					x : 0,
					y : 0
				});
			});
		});
		H.ready(function() {
			showActiveFrame(0);
			H.$getPrefs(function(ret, err) {
				if (ret && ret.value) {
					// 判断是否已登录
					H.$getPrefs(function(ret, err) {
						if (!(ret && ret.value)) {
							H.$openWin('login_head', './login/login_head.html');
						}
					}, 'user_info');
				} else {
					H.$openFrame('launch', './launch.html', null, {
						x : 0,
						y : 0
					});
				}
			}, 'launch');
			// 双击退出应用，并清除缓存
			H.$dblclickToCloseApp();
		});
	</script>
</html>